/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ventasautomotrices;

import java.awt.event.KeyEvent;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.util.LinkedList;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author granyatee
 */
public class PagarSueldo extends javax.swing.JDialog {
    /**
     * Creates new form PagarSueldo
     */
    public PagarSueldo(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.jcbMes.setSelectedIndex(3);
        montoPago = new BigDecimal("-1");
		//this.txtCodEmpleado.setText("1");
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlPagarSueldo = new javax.swing.JPanel();
        lblCodEmpleado = new javax.swing.JLabel();
        txtCodEmpleado = new javax.swing.JTextField();
        lblNombreEmpleadoEstatico = new javax.swing.JLabel();
        lblNombreEmpleadoVariable = new javax.swing.JLabel();
        btnBuscarEmpleado = new javax.swing.JButton();
        btnCalcularSueldo = new javax.swing.JButton();
        lblSueldoEmpleado = new javax.swing.JLabel();
        lblSueldoCalculado = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        txtNoCheque = new javax.swing.JTextField();
        mnuGuardarPago = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        txtNombreBanco = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jcbMes = new javax.swing.JComboBox();
        btnCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        lblCodEmpleado.setText("Codigo de Empleado:");

        txtCodEmpleado.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCodEmpleadoKeyTyped(evt);
            }
        });

        lblNombreEmpleadoEstatico.setText("Nombre:");

        lblNombreEmpleadoVariable.setBackground(new java.awt.Color(255, 255, 255));

        btnBuscarEmpleado.setText("Buscar Empleado");
        btnBuscarEmpleado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarEmpleadoActionPerformed(evt);
            }
        });

        btnCalcularSueldo.setText("Calcular Sueldo");
        btnCalcularSueldo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCalcularSueldoActionPerformed(evt);
            }
        });

        lblSueldoEmpleado.setText("Sueldo del Empleado: ");

        jLabel1.setText("No. de Cheque:");

        mnuGuardarPago.setText("Guardar");
        mnuGuardarPago.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarPagoActionPerformed(evt);
            }
        });

        jLabel2.setText("Banco:");

        jLabel3.setText("Mes:");

        jcbMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre" }));

        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlPagarSueldoLayout = new javax.swing.GroupLayout(pnlPagarSueldo);
        pnlPagarSueldo.setLayout(pnlPagarSueldoLayout);
        pnlPagarSueldoLayout.setHorizontalGroup(
            pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlPagarSueldoLayout.createSequentialGroup()
                        .addComponent(mnuGuardarPago, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(101, 101, 101)
                        .addComponent(btnCancelar)
                        .addContainerGap())
                    .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                        .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                                .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblCodEmpleado)
                                    .addComponent(lblNombreEmpleadoEstatico))
                                .addGap(18, 18, 18)
                                .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtCodEmpleado, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
                                    .addComponent(lblNombreEmpleadoVariable, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addComponent(btnBuscarEmpleado))
                            .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                                .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblSueldoEmpleado, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                                        .addGap(10, 10, 10)
                                        .addComponent(btnCalcularSueldo)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtNombreBanco, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblSueldoCalculado, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtNoCheque, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                                        .addComponent(jLabel3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jcbMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addGap(23, 23, 23))))
        );
        pnlPagarSueldoLayout.setVerticalGroup(
            pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCodEmpleado)
                    .addComponent(txtCodEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnBuscarEmpleado))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                        .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lblNombreEmpleadoEstatico, javax.swing.GroupLayout.DEFAULT_SIZE, 19, Short.MAX_VALUE)
                            .addComponent(lblNombreEmpleadoVariable, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnCalcularSueldo)
                            .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel3)
                                .addComponent(jcbMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblSueldoEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSueldoCalculado, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtNoCheque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(pnlPagarSueldoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtNombreBanco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                        .addComponent(mnuGuardarPago, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlPagarSueldoLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlPagarSueldo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlPagarSueldo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnBuscarEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarEmpleadoActionPerformed
        mostrarDetallesEmpleado();
		calcularSueldoEmpleado();
    }//GEN-LAST:event_btnBuscarEmpleadoActionPerformed

    private void btnCalcularSueldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalcularSueldoActionPerformed
        calcularSueldoEmpleado( );
    }//GEN-LAST:event_btnCalcularSueldoActionPerformed

    private void btnGuardarPagoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarPagoActionPerformed
        guardarCheque();
		JOptionPane.showMessageDialog(this, "Pago de sueldo guardado con exito", "Exito", JOptionPane.PLAIN_MESSAGE);
		this.dispose();
    }//GEN-LAST:event_btnGuardarPagoActionPerformed

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
        this.dispose();
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void txtCodEmpleadoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodEmpleadoKeyTyped
        if( evt.getKeyCode() == KeyEvent.VK_ENTER ){
			mostrarDetallesEmpleado();
			calcularSueldoEmpleado();
		}
    }//GEN-LAST:event_txtCodEmpleadoKeyTyped

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBuscarEmpleado;
    private javax.swing.JButton btnCalcularSueldo;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    public javax.swing.JComboBox jcbMes;
    private javax.swing.JLabel lblCodEmpleado;
    private javax.swing.JLabel lblNombreEmpleadoEstatico;
    public javax.swing.JLabel lblNombreEmpleadoVariable;
    public javax.swing.JLabel lblSueldoCalculado;
    private javax.swing.JLabel lblSueldoEmpleado;
    private javax.swing.JButton mnuGuardarPago;
    private javax.swing.JPanel pnlPagarSueldo;
    public javax.swing.JTextField txtCodEmpleado;
    public javax.swing.JTextField txtNoCheque;
    public javax.swing.JTextField txtNombreBanco;
    // End of variables declaration//GEN-END:variables
    
    AdminConexion ac = new AdminConexion();
    Empleado emp;
    BigDecimal montoPago;
    BigDecimal sueldoHoraEmpleado;
    
    
    public void setEmpleado( Empleado e ){
        this.emp = e;
    }
    
    /**
     * Busca en la base de datos el usuario especificado
     * @return 
     */
    public LinkedList<String> buscarEmpleado(int idEmpleado){
        LinkedList<String> ret = new LinkedList<String>();
        try {
            ac.abrirConexionBDD();
            ResultSet rs = ac.consulta("SELECT idVendedor, Nombre, Apellido, Tipo, Direccion, Celular, SueldoHora FROM AutoVentas.Empleado WHERE idVendedor=" + idEmpleado);
            while( rs.next() ){
                int idEmp = rs.getInt(1);
                if( idEmp == idEmpleado ){
                    String nombreEmpleado = rs.getString(2);
                    String apellidoEmpleado = rs.getString(3);
                    int tipoEmpleado = rs.getInt(4);
                    this.sueldoHoraEmpleado = rs.getBigDecimal(7);
                    
                    ret.add(0, Integer.toString(idEmp));
                    ret.add(1, nombreEmpleado);
                    ret.add(2, apellidoEmpleado);
                    ret.add(3, sueldoHoraEmpleado.toPlainString() );
                    ret.add(4, Integer.toString(tipoEmpleado));
                }
            }
        } catch (InstantiationException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        }finally{
            try {
                ac.cerrarConexionBDD();
            } catch (SQLException ex) {
                Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return ret;
    }
    
    public void mostrarDetallesEmpleado(){
        LinkedList<String> lem = buscarEmpleado(Integer.parseInt(this.txtCodEmpleado.getText()));
        this.lblNombreEmpleadoVariable.setText(lem.get(1) + " " + lem.get(2));
    }
    
    public void calcularSueldoEmpleado(){
		int codEmpleado = Integer.parseInt( txtCodEmpleado.getText() );
        int mes = this.jcbMes.getSelectedIndex()+1;
		
        try {
            ac.abrirConexionBDD();
            //Hace el calculo del sueldo solo con la consulta
            String query = "SELECT IFNULL(TIME_TO_SEC( SUM( HorasTrabajadas ) )/3600, 0 ) FROM ( SELECT idRegistroLogin, idVendedor, fechaLogin, EntradaSalida, fechaAnterior, TIMEDIFF(fechaLogin, fechaAnterior) AS HorasTrabajadas FROM ( SELECT idRegistroLogin, idVendedor, fechaLogin, EntradaSalida, (SELECT MAX(fechaLogin) FROM AutoVentas.RegistroLogin WHERE fechaLogin < regl.fechaLogin) AS fechaAnterior FROM AutoVentas.RegistroLogin AS regl WHERE regl.EntradaSalida = 'S' AND DATE(regl.fechaLogin) IN ( SELECT DATE(reg.fechaLogin) FROM ( SELECT rl.fechaLogin, COUNT(1) AS conteo FROM AutoVentas.RegistroLogin AS rl WHERE rl.idVendedor = ? AND MONTH( rl.fechaLogin) = ? GROUP BY DAY(rl.fechaLogin) ) AS reg WHERE reg.conteo >= 2 ) ) AS SubTotales ) AS finl";
            PreparedStatement ps = ac.prepararConsulta( query );
            ps.setInt(1, codEmpleado);
            ps.setInt(2, mes);
			//System.out.println(ps.toString());
            ResultSet rs = ps.executeQuery();
			BigDecimal segTrab = new BigDecimal(BigInteger.ZERO);
            if( rs.next() ){
				segTrab = segTrab.add(rs.getBigDecimal(1));
                //segundosTrabajados = rs.getString( 1 );
            }
            //montoPago = sueldoHoraEmpleado.multiply( new BigDecimal( segundosTrabajados ) );
			montoPago = sueldoHoraEmpleado.multiply( segTrab );
            
            query = "SELECT COUNT(1) FROM AutoVentas.Factura  WHERE Vendedor_idVendedor=? AND MONTH(Fecha) = ? GROUP BY Vendedor_idVendedor";
            ps = ac.prepararConsulta( query );
            ps.setInt(1, codEmpleado);
            ps.setInt(2, mes);
            rs = ps.executeQuery();
            int cantVentas = 0;
            if( rs.next() ){
                cantVentas = rs.getInt(1)*500;
            }
            montoPago = montoPago.add( new BigDecimal( cantVentas ) ).stripTrailingZeros();
            this.lblSueldoCalculado.setText( darFormatoQuetzal( montoPago ) );
        } catch (InstantiationException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
        }finally{
            try {
                ac.cerrarConexionBDD();
            } catch (SQLException ex) {
                Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
	
	public String darFormatoQuetzal( BigDecimal num ){
		String ret = NumberFormat.getCurrencyInstance(new Locale("es", "GT")).format(num);
		//System.out.println(ret);
		return ret;
	}
    
    public void guardarCheque(){
        String nombreBanco = txtNombreBanco.getText();
        String noCheque = txtNoCheque.getText();
        if( !nombreBanco.isEmpty() || !noCheque.isEmpty() ){
            try {
                int mes = this.jcbMes.getSelectedIndex()+1;
                Connection c = ac.abrirConexionBDD();
                PreparedStatement ps = c.prepareStatement("INSERT INTO AutoVentas.Sueldo( idSueldo, Fecha, mes, idVendedor, noCheque, Banco, Monto ) VALUES( 0, NOW(), ?, ?, ?, ?, ? )");
                ps.setInt(1, mes);
                ps.setInt(2, emp.getIdEmpleado());
                ps.setString(3, this.txtNoCheque.getText());
                ps.setString(4, this.txtNombreBanco.getText());
                ps.setString(5, montoPago.toPlainString() );
                //System.out.println(ps.toString());
                ac.insert(ps);
            } catch (InstantiationException ex) {
                Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
            }finally{
                try {
                    ac.cerrarConexionBDD();
                } catch (SQLException ex) {
                    Logger.getLogger(PagarSueldo.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }else{
            JOptionPane.showMessageDialog(this, "Debe ingresar el No. de cheque y el nombre del Banco", "Error", JOptionPane.ERROR_MESSAGE);
        }
    }

}

